<template>
    <div class="level-card" :class="{ 'level-card--locked': !level.unlocked }">
      <h2>{{ level.name }}</h2>
      <p>{{ level.description }}</p>
      <router-link v-if="level.unlocked" :to="`/level/${level.id}`">开始学习</router-link>
      <span v-else>未解锁</span>
    </div>
  </template>
  
  <script>
  export default {
    props: {
      level: {
        type: Object,
        required: true
      }
    }
  };
  </script>
  
  <style scoped>
  .level-card {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: box-shadow 0.3s ease;
  }
  .level-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  }
  .level-card--locked {
    background-color: #f5f5f5;
    opacity: 0.7;
  }
  a {
    color: #42b983;
    text-decoration: none;
    font-weight: bold;
  }
  a:hover {
    text-decoration: underline;
  }
  </style>